/*
  S.M.A.C.K - An operating system kernel
  Copyright (C) 2010,2011 Mattias Holm and Kristian Rietveld
  For licensing and a full list of authors of the kernel, see the files
  COPYING and AUTHORS.
*/

#include <ctype.h>

// BUG: Only supports the C-locale
int
isspace(int c)
{
  if (c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r')
    return 1;
  return 0;
}

int
tolower(int c)
{
  if ('A' <= c && c <= 'Z') return c + ('a' - 'A');
  return c;
}

int
toupper(int c)
{
  if ('a' <= c && c <= 'z') return c - ('a' - 'A');
  return c;
}


int
isdigit(int c)
{
  if ('0' <= c && c <= '9') return 1;
  return 0;
}

int
isxdigit(int c)
{
  if ('0' <= c && c <= '9') return 1;
  if ('a' <= c && c <= 'f') return 1;
  if ('A' <= c && c <= 'F') return 1;
  return 0;
}
